<?php
//var_dump($_POST);

$accout = $_POST['accout'];
if (!preg_match("/0?(13|14|15|17|18|19)[0-9]{9}/",$accout)){
    echo "手机格式错误";
    die();
}
$password = $_POST['password'];

if (strlen($password) < 6){
    echo "密码格式错误";
    die();
}

$users = array("user"=>$accout,"pass"=>$password);
$data = file_get_contents("users.json");
$json = $data == ''? array():json_decode($data,true);

foreach ($json as $user){
    if ($accout == $user['user']){
        if ($password==$user['pass']){
            echo "登录成功";
            die();
        }else{
            echo "密码错误";
            die();
        }
    }
}
echo "不存在该用户";
die();